import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { defHttp } from '/@/utils/http/axios';
//列表数据
export const columns : BasicColumn[] = [
	/* {
		title: 'trash',
		align: "center",
		dataIndex: 'trash'
	}, */
	{
		title: '预设旅游路线',
		align: "center",
		dataIndex: 'travellineid_dictText'
	},
	{
		title: '景区',
		align: "center",
		dataIndex: 'scenicid_dictText'
	},
	{
		title: '是否默认选择',
		align: "center",
		dataIndex: 'defaultchoice_dictText'
	},
	{
		title: '第几天',
		align: "center",
		dataIndex: 'daynum'
	},
	{
		title: '排序',
		align: "center",
		dataIndex: 'sortorder'
	},
];
//查询数据
export const searchFormSchema : FormSchema[] = [
];

export const formSchemaSelectLine : FormSchema[] = [
	{
		label: '预设旅游路线ID',
		field: 'travellineid',
		component: 'ApiSelect',
		componentProps: ({ formActionType, formModel }) => {
			return {
				//multiple: 多选；不填写为单选
				mode: '',
				//请求api,返回结果{ result: { records: [{'id':'1',name:'scott'},{'id':'2',name:'小张'}] }}
				api: () => defHttp.get({ url: '/journey/bsTravellinePlatpretravelline/getUnselectedLines' }),
				//数值转成String
				numberToString: false,
				//标题字段
				labelField: 'prelinename',
				//值字段
				valueField: 'id',
				//请求参数
				params: {
					carpoolBus: formModel.carpoolBus
				},
				//返回结果字段
				resultField: 'records'
			}

		},
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: true, message: '请选择预设旅游路线!' },
			];
		},
	},
	{
		label: '每天景点',
		field: 'travellineid',
		component: 'InputTextArea',
		slot:'selectScenic',
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: true, message: '请选择每一天景点!' },
			];
		},
	}

]


//表单数据
export const formSchema : FormSchema[] = [
	/* 	{
			label: 'trash',
			field: 'trash',
			component: 'Input',
			dynamicRules: ({ model, schema }) => {
				return [
					{ required: true, message: '请输入trash!' },
				];
			},
		}, */
	{
		label: '预设旅游路线ID',
		field: 'travellineid',
		component: 'JSearchSelect',
		componentProps: {
			dict: 'BS_TravelLine_PlatPreTravelLine,prelinename,id',
			pageSize: 10
		},
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: true, message: '请选择预设旅游路线ID!' },
			];
		},
	},

	{
		label: '是否默认选择',
		field: 'defaultchoice',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: 'trueOrFalse',
		},
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: true, message: '请选择是否默认选择!' },
			];
		},
	},
	{
		label: '第几天',
		field: 'daynum',
		component: 'InputNumber',
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: true, message: '请输入第几天!' },
			];
		},
	},
	{
		label: '排序',
		field: 'sortorder',
		component: 'InputNumber',
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: true, message: '请输入排序!' },
			];
		},
	},
	{
		label: '景点',
		field: 'scenicid',
		component: 'JCheckbox',
		componentProps: {
			dictCode: 'BS_Scenic,title,id',
		},
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: true, message: '请选择景区!' },
			];
		},
	},
	// TODO 主键隐藏字段，目前写死为ID
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData) : FormSchema[] {
	// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
	return formSchema;
}